/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.produccion.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author carlosdavid
 */
@Entity
@Table(name = "planilla_detalle", catalog = "base_prod", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PlanillaDetalle.findAll", query = "SELECT p FROM PlanillaDetalle p"),
    @NamedQuery(name = "PlanillaDetalle.findByIdPlanillaDetalle", query = "SELECT p FROM PlanillaDetalle p WHERE p.idPlanillaDetalle = :idPlanillaDetalle"),
    @NamedQuery(name = "PlanillaDetalle.findByNumPlanilla", query = "SELECT p FROM PlanillaDetalle p WHERE p.numPlanilla = :numPlanilla"),
    @NamedQuery(name = "PlanillaDetalle.findByNumPlanillaDetalle", query = "SELECT p FROM PlanillaDetalle p WHERE p.numPlanillaDetalle = :numPlanillaDetalle"),
    @NamedQuery(name = "PlanillaDetalle.findByCantidad", query = "SELECT p FROM PlanillaDetalle p WHERE p.cantidad = :cantidad"),
    @NamedQuery(name = "PlanillaDetalle.findByIdUsuario", query = "SELECT p FROM PlanillaDetalle p WHERE p.idUsuario = :idUsuario"),
    @NamedQuery(name = "PlanillaDetalle.findByFechaMod", query = "SELECT p FROM PlanillaDetalle p WHERE p.fechaMod = :fechaMod"),
    @NamedQuery(name = "PlanillaDetalle.findByFecha", query = "SELECT p FROM PlanillaDetalle p WHERE p.fecha = :fecha")})
public class PlanillaDetalle implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPlanillaDetalle", nullable = false)
    private Integer idPlanillaDetalle;
    @Column(name = "numPlanilla", length = 255)
    private String numPlanilla;
    @Column(name = "numPlanillaDetalle", length = 255)
    private String numPlanillaDetalle;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "cantidad", precision = 12)
    private Float cantidad;
    @Column(name = "idUsuario", length = 15)
    private String idUsuario;
    @Column(name = "fechaMod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaMod;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @JoinColumn(name = "idPlanilla", referencedColumnName = "idPlanilla", nullable = false)
    @ManyToOne(optional = false)
    private Planilla idPlanilla;
    @JoinColumn(name = "codPro", referencedColumnName = "codPro")
    @ManyToOne
    private Producto codPro;

    public PlanillaDetalle() {
    }

    public PlanillaDetalle(Integer idPlanillaDetalle) {
        this.idPlanillaDetalle = idPlanillaDetalle;
    }

    public Integer getIdPlanillaDetalle() {
        return idPlanillaDetalle;
    }

    public void setIdPlanillaDetalle(Integer idPlanillaDetalle) {
        this.idPlanillaDetalle = idPlanillaDetalle;
    }

    public String getNumPlanilla() {
        return numPlanilla;
    }

    public void setNumPlanilla(String numPlanilla) {
        this.numPlanilla = numPlanilla;
    }

    public String getNumPlanillaDetalle() {
        return numPlanillaDetalle;
    }

    public void setNumPlanillaDetalle(String numPlanillaDetalle) {
        this.numPlanillaDetalle = numPlanillaDetalle;
    }

    public Float getCantidad() {
        return cantidad;
    }

    public void setCantidad(Float cantidad) {
        this.cantidad = cantidad;
    }

    public String getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(String idUsuario) {
        this.idUsuario = idUsuario;
    }

    public Date getFechaMod() {
        return fechaMod;
    }

    public void setFechaMod(Date fechaMod) {
        this.fechaMod = fechaMod;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Planilla getIdPlanilla() {
        return idPlanilla;
    }

    public void setIdPlanilla(Planilla idPlanilla) {
        this.idPlanilla = idPlanilla;
    }

    public Producto getCodPro() {
        return codPro;
    }

    public void setCodPro(Producto codPro) {
        this.codPro = codPro;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlanillaDetalle != null ? idPlanillaDetalle.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PlanillaDetalle)) {
            return false;
        }
        PlanillaDetalle other = (PlanillaDetalle) object;
        if ((this.idPlanillaDetalle == null && other.idPlanillaDetalle != null) || (this.idPlanillaDetalle != null && !this.idPlanillaDetalle.equals(other.idPlanillaDetalle))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.produccion.entity.PlanillaDetalle[ idPlanillaDetalle=" + idPlanillaDetalle + " ]";
    }
    
}
